package com.training.bt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.training.bt.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    User findByEmail(String email);

    Integer existsByEmail(String email);

    User findByUsername(String username);

    Integer existsByUsername(String username);

    User findByPasskey(String passkey);

    @Update("UPDATE user SET experience = #{experience}, role = #{role} WHERE id = #{id}")
    void updateUserExperienceAndRole(User user);
}
